package com.filepd.service;

import cn.novelweb.tool.upload.local.pojo.UploadFileParam;
import com.filepd.common.R;
import com.filepd.entity.File;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
* @author Administrator
* @description 针对表【file】的数据库操作Service
* @createDate 2023-12-20 08:26:58
*/
public interface FileService extends IService<File> {

    /**
     * 上传文件
     *
     * @param file
     * @return
     */
    R<String> uploadFile(String userName, MultipartFile file);

    /**
     * 文件下载
     *
     * @param fileName
     * @param ftpFilePath
     * @param response
     */
    R<String> downloadFileToFtp(String fileName, String ftpFilePath, HttpServletResponse response);

    /**
     * 得到目录所有文件
     * @return
     */
    R<List<String>> getFilesFromFtpDirectory();

    /**
     * 得到库所有数据
     *
     * @return
     */
    List<File> getBlockAll();

    File getNewBlock();

    /**
     * 断点续传
     * @param param
     * @param request
     * @return
     */
    R<String> breakpointResumeUpload(UploadFileParam param, HttpServletRequest request);

    /**
     * 检查MD5
     * @param md5
     * @param fileName
     * @return
     */
    R<String> checkFileMd5(String md5, String fileName);

    /**
     * 数据上链
     * @return
     */
    Boolean sendContract(String userAccount,String userName,String fileName,String fileType,double fileSize);

}
